{% extends 'base.html' %}
{% block content %}
<h1>{{ post.title }}</h1>
<p>Posted on {{ post.date_posted.strftime('%Y-%m-%d') }} by User {{ post.user_id }}</p>
<p>{{ post.content }}</p>
{% if current_user.is_authenticated and current_user.id == post.user_id %}
    <a href="{{ url_for('main.edit_post', post_id=post.id) }}">Edit</a>
    <form method="POST" action="{{ url_for('main.delete_post', post_id=post.id) }}" style="display:inline;">
        <button type="submit">Delete</button>
    </form>
{% endif %}
{% endblock %}
